package com.jsb.laundry.dao;

import com.jsb.laundry.common.utils.sf.dto.FactoryInfoDto;
import com.jsb.laundry.model.dto.*;
import com.jsb.laundry.model.entity.*;
import com.jsb.laundry.model.vo.ConfirmOrderPageVo;
import com.jsb.laundry.model.vo.LaundryOrderDetailVo;
import com.jsb.laundry.model.vo.UserOrderList;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface OrderDao {

    List<ConfirmOrderPageVo.UserAddressVo> findUserAddressByUserId(@Param("userId") String uid);

    List<ConfirmOrderPageVo.CouponVo> getVipPackageInfo();

    String getUserCouponUsableNum(String uid);

    List<ConfirmOrderPageVo.OrderInfoVo> getOrderGoodsInfo(@Param("list") List list);
    List<PayModeRequest.OrderInfo> getOrderProductInfo(@Param("list") List list);

    String getOpenIdByUserId(String userId);

    int findCoupon(@Param("userId") String userId,@Param("couponId") String cardId);

    UserAddress findUserAddressByID(@Param("userId")String userId,@Param("id") String userAddressComeId);

    /**
     * 预下订单 jsb_orders 父订单
     *
     */
    int preParentOrder(JsbOrders preOrderInfo);

    /**
     * 预下订单 jsb_orders_item 子订单
     */
    int preSubOrder(@Param("list")List<JsbOrdersItem> subOrderList);

    /**
     * 预下订单 jsb_orders_transactions 订单支付记录
     */
    int preTransaction(JsbOrdersTransactions ordersPay);

    /**
     * 预下订单 jsb_orders_shipping_addresses 用户订单预约信息
     */
    int preAppointmentInfo(JsbOrdersShippingAddresses userAppointmentInfo);

    /**
     * 查询实际支付金额
     */
    int getParentOrderInfo(@Param("userId")String userId,@Param("orderId") String orderId);


    /**
     * 订单状态变更
     */
    int changeOrderStatus(JsbOrders orders);

    /**
     * 订单信息列表
     * @return
     */
    List<UserOrderList> getOrderListByUserId(@Param("userId")String userId, @Param("status")String status,@Param("keyword") String keyword);

    /**
     * 父订单信息
     */
    JsbOrders getOrderInfo(@Param("orderId") String orderId);

    /**
     * 获取用户信息
     * @param openId
     * @return
     */
    UserInfo findUserInfo(String openId);

    /**
     * 获取用户下单地址
     * @param orderId
     * @return
     */
    JsbOrdersShippingAddresses getUserAddress(String orderId);

    /**
     * 获取所有工厂
     * @return
     */
    List<ShopsLngLatDto> findAllLaundryShopsFactory();

    /**
     * 查询所有正常运营店铺(小站、旗舰店)
     * @return
     */
    List<ShopsLngLatDto> findAllLaundryShops();

    /**
     * 顺丰发货直达工厂
     * @return
     */
    List<ShopsLngLatDto> findFactory();

    /**
     * 获取所有子订单
     * @param orderId
     * @return
     */
    List<JsbOrdersItem> getSubOrderList(String orderId);

    /**
     * 获取工厂信息
     * @param shopsId
     * @return
     */
    FactoryInfoDto getLaundryFactoryInfo(String shopsId);

    /**
     *获取用户是否购买过优惠券
     * @param userId
     * @return
     */
    Boolean buyCouponEd(String userId);

    /**
     * 更新父订单状态 jsb_orders
     * @param parentOrder1
     * @return
     */
    int updParentOrderInfo(JsbOrders parentOrder1);

    /**
     * 支付成功后更新订单物流的信息 jsb_orders_fulfillment
     *
     * @return
     */
    int updOrderFlowOfSF(JsbOrdersFulfillment jsbOrdersFulfillment);

    /**
     * 更新支付明显表
     * @param ordersTransactions
     * @return
     */
    int updOrdersTransactions(JsbOrdersTransactions ordersTransactions);

    /**
     * 订单使用优惠券,优惠券使用后更新状态为已使用
     * @param userId
     * @param voucherId
     * @return
     */
    int updUseCouponRecord(@Param("userId") String userId, @Param("couponId")String voucherId);

    /**
     * 订单详情信息
     * @param userId
     * @param orderId
     * @return
     */
    LaundryOrderDetailVo orderDetail1(@Param("userId") String userId,@Param("orderId") String orderId);

    /**
     * 订单详情-用户信息
     * @param userId
     * @param orderId
     * @return
     */
    LaundryOrderDetailVo.InnerUserInfo orderDetail2(@Param("userId") String userId,@Param("orderId") String orderId);

    /**
     * 订单详情-骑士信息
     * @param orderId
     * @return
     */
    List<LaundryOrderDetailVo.InnerRiderInfo> orderDetail3(String orderId);

    /**
     * 订单详情-商品信息
     * @param orderId
     * @return
     */
    List<LaundryOrderDetailVo.InnerOrderInfo> orderDetail4(String orderId);

    List<DiffOrderStatusNumDto> diffOrderStatusNum(String userId);

    int addWorkOrder(WorkOrder workOrder);

    MonthCard getMonthCardOrderInfo(String orderId);

    CouponUserBuyRecord getVipOrderInfo(String orderId);

    SchoolRecord getSchoolOrderInfo(String orderId);

    UserInfo findUserInfoByUserId(String userId);

    /**
     * 调整月卡状态为已使用
     * @param userId
     * @param monthCardId
     * @return
     */
    int updMonthCardUseStatus(@Param("userId")String userId,@Param("monthCardId") String monthCardId);

    List<WxRiderList> findByqOpenId();

    PayOrderInfo findBySendInfo(String orderId);

    CouponUserBag getCouponUseStatus(String couponCardId);

    String getSchoolCardInfo(String schoolCardId);

    List<UserBuyInfo> userBuyInfo();

    int addOrderStatusLog(@Param("orderId") String orderId,@Param("code") String code,@Param("msg") String msg,@Param("orderDirection") String orderDirection);

    JsbOrdersFactory getOrdersFactoryInfo(String payId);

    Integer addOrderFactory(JsbOrdersFactory ordersFactory);

    int addOrderFactoryItem(@Param("list")List<JsbOrdersFactoryItem> jsbOrdersFactoryItem);

    String getRiderPromotion(String userId);
    /**
     * 抽奖邀请人人加次数
     * @param userId
     * @param num
     * @return
     */
    int updUserLotteryNum(@Param("userId") String userId, @Param("num") int num);

    /**
     * 抽奖邀请途径加次数
     * @param userId
     * @param access
     * @param obtainedTimes
     * @return
     */
    int addUserLotteryRecordRoad(@Param("userId") String userId, @Param("access") String access, @Param("accessType") String accessType, @Param("obtainedTimes") int obtainedTimes);

    /**
     * 添加到白名单
     * @param userId
     * @return
     */
    int updateWhite(String userId);

    /**
     * 更新订单状态为已完成
     * @param orderId
     * @return
     */
    int updParentOrderSuccessAt(String orderId);

//    List<UserBuyInfo> userBuyInfo();

}
